//设置localStorage
export function setCookie(key: any, value: any) {
  return localStorage.setItem(key, JSON.stringify(value))
}

//获取localStorage
export function getCookie(key: any) {
  try {
    const value = localStorage.getItem(key)

    if (value === null || value === undefined || value === '') {
      return null
    } else {
      return JSON.parse(localStorage.getItem(key) as string)
    }
  } catch {
    return null
  }
}

//移除localStorage
export function removeCookie(key: any) {
  return localStorage.removeItem(key)
}
